home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / include / netinet / in.h < prev    next >
C/C++ Source or Header  |  2008-09-29  |  18KB  |  564 lines

  1. /* Copyright (C) 1991-2001, 2003, 2004, 2006, 2007
  2.    Free Software Foundation, Inc.
  3.    This file is part of the GNU C Library.
  4.  
  5.    The GNU C Library is free software; you can redistribute it and/or
  6.    modify it under the terms of the GNU Lesser General Public
  7.    License as published by the Free Software Foundation; either
  8.    version 2.1 of the License, or (at your option) any later version.
  9.  
  10.    The GNU C Library is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    Lesser General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU Lesser General Public
  16.    License along with the GNU C Library; if not, write to the Free
  17.    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  18.    02111-1307 USA.  */
  19.  
  20. #ifndef    _NETINET_IN_H
  21. #define    _NETINET_IN_H    1
  22.  
  23. #include <features.h>
  24. #include <stdint.h>
  25. #include <sys/socket.h>
  26. #include <bits/types.h>
  27.  
  28.  
  29. __BEGIN_DECLS
  30.  
  31. /* Standard well-defined IP protocols.  */
  32. enum
  33.   {
  34.     IPPROTO_IP = 0,       /* Dummy protocol for TCP.  */
  35. #define IPPROTO_IP        IPPROTO_IP
  36.     IPPROTO_HOPOPTS = 0,   /* IPv6 Hop-by-Hop options.  */
  37. #define IPPROTO_HOPOPTS        IPPROTO_HOPOPTS
  38.     IPPROTO_ICMP = 1,       /* Internet Control Message Protocol.  */
  39. #define IPPROTO_ICMP        IPPROTO_ICMP
  40.     IPPROTO_IGMP = 2,       /* Internet Group Management Protocol. */
  41. #define IPPROTO_IGMP        IPPROTO_IGMP
  42.     IPPROTO_IPIP = 4,       /* IPIP tunnels (older KA9Q tunnels use 94).  */
  43. #define IPPROTO_IPIP        IPPROTO_IPIP
  44.     IPPROTO_TCP = 6,       /* Transmission Control Protocol.  */
  45. #define IPPROTO_TCP        IPPROTO_TCP
  46.     IPPROTO_EGP = 8,       /* Exterior Gateway Protocol.  */
  47. #define IPPROTO_EGP        IPPROTO_EGP
  48.     IPPROTO_PUP = 12,       /* PUP protocol.  */
  49. #define IPPROTO_PUP        IPPROTO_PUP
  50.     IPPROTO_UDP = 17,       /* User Datagram Protocol.  */
  51. #define IPPROTO_UDP        IPPROTO_UDP
  52.     IPPROTO_IDP = 22,       /* XNS IDP protocol.  */
  53. #define IPPROTO_IDP        IPPROTO_IDP
  54.     IPPROTO_TP = 29,       /* SO Transport Protocol Class 4.  */
  55. #define IPPROTO_TP        IPPROTO_TP
  56.     IPPROTO_IPV6 = 41,     /* IPv6 header.  */
  57. #define IPPROTO_IPV6        IPPROTO_IPV6
  58.     IPPROTO_ROUTING = 43,  /* IPv6 routing header.  */
  59. #define IPPROTO_ROUTING        IPPROTO_ROUTING
  60.     IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header.  */
  61. #define IPPROTO_FRAGMENT    IPPROTO_FRAGMENT
  62.     IPPROTO_RSVP = 46,       /* Reservation Protocol.  */
  63. #define IPPROTO_RSVP        IPPROTO_RSVP
  64.     IPPROTO_GRE = 47,       /* General Routing Encapsulation.  */
  65. #define IPPROTO_GRE        IPPROTO_GRE
  66.     IPPROTO_ESP = 50,      /* encapsulating security payload.  */
  67. #define IPPROTO_ESP        IPPROTO_ESP
  68.     IPPROTO_AH = 51,       /* authentication header.  */
  69. #define IPPROTO_AH        IPPROTO_AH
  70.     IPPROTO_ICMPV6 = 58,   /* ICMPv6.  */
  71. #define IPPROTO_ICMPV6        IPPROTO_ICMPV6
  72.     IPPROTO_NONE = 59,     /* IPv6 no next header.  */
  73. #define IPPROTO_NONE        IPPROTO_NONE
  74.     IPPROTO_DSTOPTS = 60,  /* IPv6 destination options.  */
  75. #define IPPROTO_DSTOPTS        IPPROTO_DSTOPTS
  76.     IPPROTO_MTP = 92,       /* Multicast Transport Protocol.  */
  77. #define IPPROTO_MTP        IPPROTO_MTP
  78.     IPPROTO_ENCAP = 98,       /* Encapsulation Header.  */
  79. #define IPPROTO_ENCAP        IPPROTO_ENCAP
  80.     IPPROTO_PIM = 103,       /* Protocol Independent Multicast.  */
  81. #define IPPROTO_PIM        IPPROTO_PIM
  82.     IPPROTO_COMP = 108,       /* Compression Header Protocol.  */
  83. #define IPPROTO_COMP        IPPROTO_COMP
  84.     IPPROTO_SCTP = 132,       /* Stream Control Transmission Protocol.  */
  85. #define IPPROTO_SCTP        IPPROTO_SCTP
  86.     IPPROTO_RAW = 255,       /* Raw IP packets.  */
  87. #define IPPROTO_RAW        IPPROTO_RAW
  88.     IPPROTO_MAX
  89.   };
  90.  
  91.  
  92. /* Type to represent a port.  */
  93. typedef uint16_t in_port_t;
  94.  
  95. /* Standard well-known ports.  */
  96. enum
  97.   {
  98.     IPPORT_ECHO = 7,        /* Echo service.  */
  99.     IPPORT_DISCARD = 9,        /* Discard transmissions service.  */
  100.     IPPORT_SYSTAT = 11,        /* System status service.  */
  101.     IPPORT_DAYTIME = 13,    /* Time of day service.  */
  102.     IPPORT_NETSTAT = 15,    /* Network status service.  */
  103.     IPPORT_FTP = 21,        /* File Transfer Protocol.  */
  104.     IPPORT_TELNET = 23,        /* Telnet protocol.  */
  105.     IPPORT_SMTP = 25,        /* Simple Mail Transfer Protocol.  */
  106.     IPPORT_TIMESERVER = 37,    /* Timeserver service.  */
  107.     IPPORT_NAMESERVER = 42,    /* Domain Name Service.  */
  108.     IPPORT_WHOIS = 43,        /* Internet Whois service.  */
  109.     IPPORT_MTP = 57,
  110.  
  111.     IPPORT_TFTP = 69,        /* Trivial File Transfer Protocol.  */
  112.     IPPORT_RJE = 77,
  113.     IPPORT_FINGER = 79,        /* Finger service.  */
  114.     IPPORT_TTYLINK = 87,
  115.     IPPORT_SUPDUP = 95,        /* SUPDUP protocol.  */
  116.  
  117.  
  118.     IPPORT_EXECSERVER = 512,    /* execd service.  */
  119.     IPPORT_LOGINSERVER = 513,    /* rlogind service.  */
  120.     IPPORT_CMDSERVER = 514,
  121.     IPPORT_EFSSERVER = 520,
  122.  
  123.     /* UDP ports.  */
  124.     IPPORT_BIFFUDP = 512,
  125.     IPPORT_WHOSERVER = 513,
  126.     IPPORT_ROUTESERVER = 520,
  127.  
  128.     /* Ports less than this value are reserved for privileged processes.  */
  129.     IPPORT_RESERVED = 1024,
  130.  
  131.     /* Ports greater this value are reserved for (non-privileged) servers.  */
  132.     IPPORT_USERRESERVED = 5000
  133.   };
  134.  
  135.  
  136. /* Internet address.  */
  137. typedef uint32_t in_addr_t;
  138. struct in_addr
  139.   {
  140.     in_addr_t s_addr;
  141.   };
  142.  
  143.  
  144. /* Definitions of the bits in an Internet address integer.
  145.  
  146.    On subnets, host and network parts are found according to
  147.    the subnet mask, not these masks.  */
  148.  
  149. #define    IN_CLASSA(a)        ((((in_addr_t)(a)) & 0x80000000) == 0)
  150. #define    IN_CLASSA_NET        0xff000000
  151. #define    IN_CLASSA_NSHIFT    24
  152. #define    IN_CLASSA_HOST        (0xffffffff & ~IN_CLASSA_NET)
  153. #define    IN_CLASSA_MAX        128
  154.  
  155. #define    IN_CLASSB(a)        ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000)
  156. #define    IN_CLASSB_NET        0xffff0000
  157. #define    IN_CLASSB_NSHIFT    16
  158. #define    IN_CLASSB_HOST        (0xffffffff & ~IN_CLASSB_NET)
  159. #define    IN_CLASSB_MAX        65536
  160.  
  161. #define    IN_CLASSC(a)        ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000)
  162. #define    IN_CLASSC_NET        0xffffff00
  163. #define    IN_CLASSC_NSHIFT    8
  164. #define    IN_CLASSC_HOST        (0xffffffff & ~IN_CLASSC_NET)
  165.  
  166. #define    IN_CLASSD(a)        ((((in_addr_t)(a)) & 0xf0000000) == 0xe0000000)
  167. #define    IN_MULTICAST(a)        IN_CLASSD(a)
  168.  
  169. #define    IN_EXPERIMENTAL(a)    ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000)
  170. #define    IN_BADCLASS(a)        ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000)
  171.  
  172. /* Address to accept any incoming messages.  */
  173. #define    INADDR_ANY        ((in_addr_t) 0x00000000)
  174. /* Address to send to all hosts.  */
  175. #define    INADDR_BROADCAST    ((in_addr_t) 0xffffffff)
  176. /* Address indicating an error return.  */
  177. #define    INADDR_NONE        ((in_addr_t) 0xffffffff)
  178.  
  179. /* Network number for local host loopback.  */
  180. #define    IN_LOOPBACKNET        127
  181. /* Address to loopback in software to local host.  */
  182. #ifndef INADDR_LOOPBACK
  183. # define INADDR_LOOPBACK    ((in_addr_t) 0x7f000001) /* Inet 127.0.0.1.  */
  184. #endif
  185.  
  186. /* Defines for Multicast INADDR.  */
  187. #define INADDR_UNSPEC_GROUP    ((in_addr_t) 0xe0000000) /* 224.0.0.0 */
  188. #define INADDR_ALLHOSTS_GROUP    ((in_addr_t) 0xe0000001) /* 224.0.0.1 */
  189. #define INADDR_ALLRTRS_GROUP    ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
  190. #define INADDR_MAX_LOCAL_GROUP  ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
  191.  
  192.  
  193. /* IPv6 address */
  194. struct in6_addr
  195.   {
  196.     union
  197.       {
  198.     uint8_t    __u6_addr8[16];
  199. #if defined __USE_MISC || defined __USE_GNU
  200.     uint16_t __u6_addr16[8];
  201.     uint32_t __u6_addr32[4];
  202. #endif
  203.       } __in6_u;
  204. #define s6_addr            __in6_u.__u6_addr8
  205. #if defined __USE_MISC || defined __USE_GNU
  206. # define s6_addr16        __in6_u.__u6_addr16
  207. # define s6_addr32        __in6_u.__u6_addr32
  208. #endif
  209.   };
  210.  
  211. extern const struct in6_addr in6addr_any;        /* :: */
  212. extern const struct in6_addr in6addr_loopback;   /* ::1 */
  213. #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
  214. #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
  215.  
  216. #define INET_ADDRSTRLEN 16
  217. #define INET6_ADDRSTRLEN 46
  218.  
  219.  
  220. /* Structure describing an Internet socket address.  */
  221. struct sockaddr_in
  222.   {
  223.     __SOCKADDR_COMMON (sin_);
  224.     in_port_t sin_port;            /* Port number.  */
  225.     struct in_addr sin_addr;        /* Internet address.  */
  226.  
  227.     /* Pad to size of `struct sockaddr'.  */
  228.     unsigned char sin_zero[sizeof (struct sockaddr) -
  229.                __SOCKADDR_COMMON_SIZE -
  230.                sizeof (in_port_t) -
  231.                sizeof (struct in_addr)];
  232.   };
  233.  
  234. /* Ditto, for IPv6.  */
  235. struct sockaddr_in6
  236.   {
  237.     __SOCKADDR_COMMON (sin6_);
  238.     in_port_t sin6_port;    /* Transport layer port # */
  239.     uint32_t sin6_flowinfo;    /* IPv6 flow information */
  240.     struct in6_addr sin6_addr;    /* IPv6 address */
  241.     uint32_t sin6_scope_id;    /* IPv6 scope-id */
  242.   };
  243.  
  244.  
  245. #if defined __USE_MISC || defined __USE_GNU
  246. /* IPv4 multicast request.  */
  247. struct ip_mreq
  248.   {
  249.     /* IP multicast address of group.  */
  250.     struct in_addr imr_multiaddr;
  251.  
  252.     /* Local IP address of interface.  */
  253.     struct in_addr imr_interface;
  254.   };
  255.  
  256. struct ip_mreq_source
  257.   {
  258.     /* IP multicast address of group.  */
  259.     struct in_addr imr_multiaddr;
  260.  
  261.     /* IP address of source.  */
  262.     struct in_addr imr_interface;
  263.  
  264.     /* IP address of interface.  */
  265.     struct in_addr imr_sourceaddr;
  266.   };
  267. #endif
  268.  
  269.  
  270. /* Likewise, for IPv6.  */
  271. struct ipv6_mreq
  272.   {
  273.     /* IPv6 multicast address of group */
  274.     struct in6_addr ipv6mr_multiaddr;
  275.  
  276.     /* local interface */
  277.     unsigned int ipv6mr_interface;
  278.   };
  279.  
  280.  
  281. #if defined __USE_MISC || defined __USE_GNU
  282. /* Multicast group request.  */
  283. struct group_req
  284.   {
  285.     /* Interface index.  */
  286.     uint32_t gr_interface;
  287.  
  288.     /* Group address.  */
  289.     struct sockaddr_storage gr_group;
  290.   };
  291.  
  292. struct group_source_req
  293.   {
  294.     /* Interface index.  */
  295.     uint32_t gsr_interface;
  296.  
  297.     /* Group address.  */
  298.     struct sockaddr_storage gsr_group;
  299.  
  300.     /* Source address.  */
  301.     struct sockaddr_storage gsr_source;
  302.   };
  303.  
  304.  
  305. /* Full-state filter operations.  */
  306. struct ip_msfilter
  307.   {
  308.     /* IP multicast address of group.  */
  309.     struct in_addr imsf_multiaddr;
  310.  
  311.     /* Local IP address of interface.  */
  312.     struct in_addr imsf_interface;
  313.  
  314.     /* Filter mode.  */
  315.     uint32_t imsf_fmode;
  316.  
  317.     /* Number of source addresses.  */
  318.     uint32_t imsf_numsrc;
  319.     /* Source addresses.  */
  320.     struct in_addr imsf_slist[1];
  321.   };
  322.  
  323. #define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
  324.                   - sizeof (struct in_addr)              \
  325.                   + (numsrc) * sizeof (struct in_addr))
  326.  
  327. struct group_filter
  328.   {
  329.     /* Interface index.  */
  330.     uint32_t gf_interface;
  331.  
  332.     /* Group address.  */
  333.     struct sockaddr_storage gf_group;
  334.  
  335.     /* Filter mode.  */
  336.     uint32_t gf_fmode;
  337.  
  338.     /* Number of source addresses.  */
  339.     uint32_t gf_numsrc;
  340.     /* Source addresses.  */
  341.     struct sockaddr_storage gf_slist[1];
  342. };
  343.  
  344. #define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
  345.                    - sizeof (struct sockaddr_storage)          \
  346.                    + ((numsrc)                      \
  347.                       * sizeof (struct sockaddr_storage)))
  348. #endif
  349.  
  350.  
  351. /* Get system-specific definitions.  */
  352. #include <bits/in.h>
  353.  
  354. /* Functions to convert between host and network byte order.
  355.  
  356.    Please note that these functions normally take `unsigned long int' or
  357.    `unsigned short int' values as arguments and also return them.  But
  358.    this was a short-sighted decision since on different systems the types
  359.    may have different representations but the values are always the same.  */
  360.  
  361. extern uint32_t ntohl (uint32_t __netlong) __THROW __attribute__ ((__const__));
  362. extern uint16_t ntohs (uint16_t __netshort)
  363.      __THROW __attribute__ ((__const__));
  364. extern uint32_t htonl (uint32_t __hostlong)
  365.      __THROW __attribute__ ((__const__));
  366. extern uint16_t htons (uint16_t __hostshort)
  367.      __THROW __attribute__ ((__const__));
  368.  
  369. #include <endian.h>
  370.  
  371. /* Get machine dependent optimized versions of byte swapping functions.  */
  372. #include <bits/byteswap.h>
  373.  
  374. #ifdef __OPTIMIZE__
  375. /* We can optimize calls to the conversion functions.  Either nothing has
  376.    to be done or we are using directly the byte-swapping functions which
  377.    often can be inlined.  */
  378. # if __BYTE_ORDER == __BIG_ENDIAN
  379. /* The host byte order is the same as network byte order,
  380.    so these functions are all just identity.  */
  381. # define ntohl(x)    (x)
  382. # define ntohs(x)    (x)
  383. # define htonl(x)    (x)
  384. # define htons(x)    (x)
  385. # else
  386. #  if __BYTE_ORDER == __LITTLE_ENDIAN
  387. #   define ntohl(x)    __bswap_32 (x)
  388. #   define ntohs(x)    __bswap_16 (x)
  389. #   define htonl(x)    __bswap_32 (x)
  390. #   define htons(x)    __bswap_16 (x)
  391. #  endif
  392. # endif
  393. #endif
  394.  
  395. #define IN6_IS_ADDR_UNSPECIFIED(a) \
  396.     (((__const uint32_t *) (a))[0] == 0                      \
  397.      && ((__const uint32_t *) (a))[1] == 0                      \
  398.      && ((__const uint32_t *) (a))[2] == 0                      \
  399.      && ((__const uint32_t *) (a))[3] == 0)
  400.  
  401. #define IN6_IS_ADDR_LOOPBACK(a) \
  402.     (((__const uint32_t *) (a))[0] == 0                      \
  403.      && ((__const uint32_t *) (a))[1] == 0                      \
  404.      && ((__const uint32_t *) (a))[2] == 0                      \
  405.      && ((__const uint32_t *) (a))[3] == htonl (1))
  406.  
  407. #define IN6_IS_ADDR_MULTICAST(a) (((__const uint8_t *) (a))[0] == 0xff)
  408.  
  409. #define IN6_IS_ADDR_LINKLOCAL(a) \
  410.     ((((__const uint32_t *) (a))[0] & htonl (0xffc00000))              \
  411.      == htonl (0xfe800000))
  412.  
  413. #define IN6_IS_ADDR_SITELOCAL(a) \
  414.     ((((__const uint32_t *) (a))[0] & htonl (0xffc00000))              \
  415.      == htonl (0xfec00000))
  416.  
  417. #define IN6_IS_ADDR_V4MAPPED(a) \
  418.     ((((__const uint32_t *) (a))[0] == 0)                      \
  419.      && (((__const uint32_t *) (a))[1] == 0)                  \
  420.      && (((__const uint32_t *) (a))[2] == htonl (0xffff)))
  421.  
  422. #define IN6_IS_ADDR_V4COMPAT(a) \
  423.     ((((__const uint32_t *) (a))[0] == 0)                      \
  424.      && (((__const uint32_t *) (a))[1] == 0)                  \
  425.      && (((__const uint32_t *) (a))[2] == 0)                  \
  426.      && (ntohl (((__const uint32_t *) (a))[3]) > 1))
  427.  
  428. #define IN6_ARE_ADDR_EQUAL(a,b) \
  429.     ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0])     \
  430.      && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1])  \
  431.      && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2])  \
  432.      && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
  433.  
  434. #if defined __USE_MISC || defined __USE_GNU
  435. /* Bind socket to a privileged IP port.  */
  436. extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __THROW;
  437.  
  438. /* The IPv6 version of this function.  */
  439. extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
  440.      __THROW;
  441. #endif
  442.  
  443.  
  444. #define IN6_IS_ADDR_MC_NODELOCAL(a) \
  445.     (IN6_IS_ADDR_MULTICAST(a)                          \
  446.      && ((((__const uint8_t *) (a))[1] & 0xf) == 0x1))
  447.  
  448. #define IN6_IS_ADDR_MC_LINKLOCAL(a) \
  449.     (IN6_IS_ADDR_MULTICAST(a)                          \
  450.      && ((((__const uint8_t *) (a))[1] & 0xf) == 0x2))
  451.  
  452. #define IN6_IS_ADDR_MC_SITELOCAL(a) \
  453.     (IN6_IS_ADDR_MULTICAST(a)                          \
  454.      && ((((__const uint8_t *) (a))[1] & 0xf) == 0x5))
  455.  
  456. #define IN6_IS_ADDR_MC_ORGLOCAL(a) \
  457.     (IN6_IS_ADDR_MULTICAST(a)                          \
  458.      && ((((__const uint8_t *) (a))[1] & 0xf) == 0x8))
  459.  
  460. #define IN6_IS_ADDR_MC_GLOBAL(a) \
  461.     (IN6_IS_ADDR_MULTICAST(a)                          \
  462.      && ((((__const uint8_t *) (a))[1] & 0xf) == 0xe))
  463.  
  464.  
  465. #ifdef __USE_GNU
  466. /* IPv6 packet information.  */
  467. struct in6_pktinfo
  468.   {
  469.     struct in6_addr ipi6_addr;    /* src/dst IPv6 address */
  470.     unsigned int ipi6_ifindex;    /* send/recv interface index */
  471.   };
  472.  
  473. /* IPv6 MTU information.  */
  474. struct ip6_mtuinfo
  475.   {
  476.     struct sockaddr_in6 ip6m_addr; /* dst address including zone ID */
  477.     uint32_t ip6m_mtu;           /* path MTU in host byte order */
  478.   };
  479.  
  480.  
  481. /* Obsolete hop-by-hop and Destination Options Processing (RFC 2292).  */
  482. extern int inet6_option_space (int __nbytes)
  483.      __THROW __attribute_deprecated__;
  484. extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp,
  485.                   int __type) __THROW __attribute_deprecated__;
  486. extern int inet6_option_append (struct cmsghdr *__cmsg,
  487.                 __const uint8_t *__typep, int __multx,
  488.                 int __plusy) __THROW __attribute_deprecated__;
  489. extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen,
  490.                     int __multx, int __plusy)
  491.      __THROW __attribute_deprecated__;
  492. extern int inet6_option_next (__const struct cmsghdr *__cmsg,
  493.                   uint8_t **__tptrp)
  494.      __THROW __attribute_deprecated__;
  495. extern int inet6_option_find (__const struct cmsghdr *__cmsg,
  496.                   uint8_t **__tptrp, int __type)
  497.      __THROW __attribute_deprecated__;
  498.  
  499.  
  500. /* Hop-by-Hop and Destination Options Processing (RFC 3542).  */
  501. extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __THROW;
  502. extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset,
  503.                  uint8_t __type, socklen_t __len, uint8_t __align,
  504.                  void **__databufp) __THROW;
  505. extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset)
  506.      __THROW;
  507. extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val,
  508.                   socklen_t __vallen) __THROW;
  509. extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset,
  510.                uint8_t *__typep, socklen_t *__lenp,
  511.                void **__databufp) __THROW;
  512. extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset,
  513.                uint8_t __type, socklen_t *__lenp,
  514.                void **__databufp) __THROW;
  515. extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val,
  516.                   socklen_t __vallen) __THROW;
  517.  
  518.  
  519. /* Routing Header Option (RFC 3542).  */
  520. extern socklen_t inet6_rth_space (int __type, int __segments) __THROW;
  521. extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type,
  522.                  int __segments) __THROW;
  523. extern int inet6_rth_add (void *__bp, __const struct in6_addr *__addr) __THROW;
  524. extern int inet6_rth_reverse (__const void *__in, void *__out) __THROW;
  525. extern int inet6_rth_segments (__const void *__bp) __THROW;
  526. extern struct in6_addr *inet6_rth_getaddr (__const void *__bp, int __index)
  527.      __THROW;
  528.  
  529.  
  530. /* Multicast source filter support.  */
  531.  
  532. /* Get IPv4 source filter.  */
  533. extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr,
  534.                 struct in_addr __group, uint32_t *__fmode,
  535.                 uint32_t *__numsrc, struct in_addr *__slist)
  536.      __THROW;
  537.  
  538. /* Set IPv4 source filter.  */
  539. extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr,
  540.                 struct in_addr __group, uint32_t __fmode,
  541.                 uint32_t __numsrc,
  542.                 __const struct in_addr *__slist)
  543.      __THROW;
  544.  
  545.  
  546. /* Get source filter.  */
  547. extern int getsourcefilter (int __s, uint32_t __interface_addr,
  548.                 __const struct sockaddr *__group,
  549.                 socklen_t __grouplen, uint32_t *__fmode,
  550.                 uint32_t *__numsrc,
  551.                 struct sockaddr_storage *__slist) __THROW;
  552.  
  553. /* Set source filter.  */
  554. extern int setsourcefilter (int __s, uint32_t __interface_addr,
  555.                 __const struct sockaddr *__group,
  556.                 socklen_t __grouplen, uint32_t __fmode,
  557.                 uint32_t __numsrc,
  558.                 __const struct sockaddr_storage *__slist) __THROW;
  559. #endif    /* use GNU */
  560.  
  561. __END_DECLS
  562.  
  563. #endif    /* netinet/in.h */
  564.